<%@ page import="java.sql.*" %>
<%--
  Created by IntelliJ IDEA.
  User: 113
  Date: 2020/10/7
  Time: 8:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>个人中心</title>
</head>
<link rel="stylesheet" href="css/bootstrap.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.bundle.js"></script>
<body>
<%

        out.print("<h3 style='text-align:center'>欢迎来到个人主页！</h3>");
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/book";
        Connection connection = DriverManager.getConnection(url, "root", "root");
        String sql = "select * from user ";

        PreparedStatement ps = connection.prepareStatement(sql);

        ResultSet rs = ps.executeQuery();
%>
    <div class="container">
    <div class="row clearfix">
    <div class="col-md-12 column">

    <table class="table">
    <thead>
    <tr>
    <th>
    编号
    </th>
    <th>
    用户
    </th>
    <th>
    密码
    </th>
    <th>
    性别
    </th>
        <th>
            年龄
        </th>
        <th >操作</th>
    </tr>
    </thead>
    <tbody>
    <%
        while (rs.next()) {
            out.print("<tr>");
            out.print("<td>"+rs.getString("id")+"</td>"+"<td>"+rs.getString("username")+"</td>"+"<td>"+rs.getString("password")+"</td>"+"<td>"+rs.getString("gender")+"</td>"+"<td>"+rs.getString("age")+"</td>"+
                    "<td><a href='delete.jsp?id="+rs.getInt("id")+"'>删除</a>&nbsp;&nbsp;&nbsp;<a href='edit.jsp?id=+rs.getInt(id)+'>修改</a></td>");
        }


    %>
    </tbody>
    </table>
    </div>
    </div>
    </div>
</body>
</html>
